3.5.19 \(\int \cot ^2(c+d x) (a+b \tan (c+d x)) \, dx\) [419]

Optimal. Leaf size=29 \[ -a x-\frac {a \cot (c+d x)}{d}+\frac {b \log (\sin (c+d x))}{d} \]

[Out]

-a*x-a*cot(d*x+c)/d+b*ln(sin(d*x+c))/d

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 29, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3610, 3612, 3556} \begin {gather*} -\frac {a \cot (c+d x)}{d}-a x+\frac {b \log (\sin (c+d x))}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]^2*(a + b*Tan[c + d*x]),x]

[Out]

-(a*x) - (a*Cot[c + d*x])/d + (b*Log[Sin[c + d*x]])/d

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3610

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b
*c - a*d)*((a + b*Tan[e + f*x])^(m + 1)/(f*(m + 1)*(a^2 + b^2))), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e +
f*x])^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c
 - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rubi steps

\begin {align*} \int \cot ^2(c+d x) (a+b \tan (c+d x)) \, dx &=-\frac {a \cot (c+d x)}{d}+\int \cot (c+d x) (b-a \tan (c+d x)) \, dx\\ &=-a x-\frac {a \cot (c+d x)}{d}+b \int \cot (c+d x) \, dx\\ &=-a x-\frac {a \cot (c+d x)}{d}+\frac {b \log (\sin (c+d x))}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.
time = 0.13, size = 51, normalized size = 1.76 \begin {gather*} -\frac {a \cot (c+d x) \, _2F_1\left (-\frac {1}{2},1;\frac {1}{2};-\tan ^2(c+d x)\right )}{d}+\frac {b (\log (\cos (c+d x))+\log (\tan (c+d x)))}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]^2*(a + b*Tan[c + d*x]),x]

[Out]

-((a*Cot[c + d*x]*Hypergeometric2F1[-1/2, 1, 1/2, -Tan[c + d*x]^2])/d) + (b*(Log[Cos[c + d*x]] + Log[Tan[c + d
*x]]))/d

________________________________________________________________________________________

Maple [A]
time = 0.12, size = 33, normalized size = 1.14

method result size
derivativedivides \(\frac {a \left (-\cot \left (d x +c \right )-d x -c \right )+b \ln \left (\sin \left (d x +c \right )\right )}{d}\) \(33\)
default \(\frac {a \left (-\cot \left (d x +c \right )-d x -c \right )+b \ln \left (\sin \left (d x +c \right )\right )}{d}\) \(33\)
risch \(-i b x -a x -\frac {2 i b c}{d}-\frac {2 i a}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}+\frac {b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d}\) \(56\)
norman \(\frac {-\frac {a}{d}-a x \tan \left (d x +c \right )}{\tan \left (d x +c \right )}+\frac {b \ln \left (\tan \left (d x +c \right )\right )}{d}-\frac {b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) \(57\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)^2*(a+b*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(a*(-cot(d*x+c)-d*x-c)+b*ln(sin(d*x+c)))

________________________________________________________________________________________

Maxima [A]
time = 0.52, size = 48, normalized size = 1.66 \begin {gather*} -\frac {2 \, {\left (d x + c\right )} a + b \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - 2 \, b \log \left (\tan \left (d x + c\right )\right ) + \frac {2 \, a}{\tan \left (d x + c\right )}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2*(a+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*(2*(d*x + c)*a + b*log(tan(d*x + c)^2 + 1) - 2*b*log(tan(d*x + c)) + 2*a/tan(d*x + c))/d

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 59 vs. \(2 (29) = 58\).
time = 1.21, size = 59, normalized size = 2.03 \begin {gather*} -\frac {2 \, a d x \tan \left (d x + c\right ) - b \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) \tan \left (d x + c\right ) + 2 \, a}{2 \, d \tan \left (d x + c\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2*(a+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

-1/2*(2*a*d*x*tan(d*x + c) - b*log(tan(d*x + c)^2/(tan(d*x + c)^2 + 1))*tan(d*x + c) + 2*a)/(d*tan(d*x + c))

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 70 vs. \(2 (24) = 48\).
time = 0.35, size = 70, normalized size = 2.41 \begin {gather*} \begin {cases} \tilde {\infty } a x & \text {for}\: \left (c = 0 \vee c = - d x\right ) \wedge \left (c = - d x \vee d = 0\right ) \\x \left (a + b \tan {\left (c \right )}\right ) \cot ^{2}{\left (c \right )} & \text {for}\: d = 0 \\- a x - \frac {a}{d \tan {\left (c + d x \right )}} - \frac {b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {b \log {\left (\tan {\left (c + d x \right )} \right )}}{d} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)**2*(a+b*tan(d*x+c)),x)

[Out]

Piecewise((zoo*a*x, (Eq(c, 0) | Eq(c, -d*x)) & (Eq(d, 0) | Eq(c, -d*x))), (x*(a + b*tan(c))*cot(c)**2, Eq(d, 0
)), (-a*x - a/(d*tan(c + d*x)) - b*log(tan(c + d*x)**2 + 1)/(2*d) + b*log(tan(c + d*x))/d, True))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 83 vs. \(2 (29) = 58\).
time = 0.58, size = 83, normalized size = 2.86 \begin {gather*} -\frac {2 \, {\left (d x + c\right )} a + 2 \, b \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right ) - 2 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + \frac {2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2*(a+b*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/2*(2*(d*x + c)*a + 2*b*log(tan(1/2*d*x + 1/2*c)^2 + 1) - 2*b*log(abs(tan(1/2*d*x + 1/2*c))) - a*tan(1/2*d*x
 + 1/2*c) + (2*b*tan(1/2*d*x + 1/2*c) + a)/tan(1/2*d*x + 1/2*c))/d

________________________________________________________________________________________

Mupad [B]
time = 4.10, size = 70, normalized size = 2.41 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-\frac {b}{2}+\frac {a\,1{}\mathrm {i}}{2}\right )}{d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (\frac {b}{2}+\frac {a\,1{}\mathrm {i}}{2}\right )}{d}+\frac {b\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d}-\frac {a\,\mathrm {cot}\left (c+d\,x\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(c + d*x)^2*(a + b*tan(c + d*x)),x)

[Out]

(log(tan(c + d*x) - 1i)*((a*1i)/2 - b/2))/d - (log(tan(c + d*x) + 1i)*((a*1i)/2 + b/2))/d + (b*log(tan(c + d*x
)))/d - (a*cot(c + d*x))/d

________________________________________________________________________________________